import React from 'react';
import { Router, Route, IndexRoute } from 'dva/router';
import IndexPage from './routes/IndexPage';
import UserLogin from "./routes/user/login";
import UserMain from "./routes/user/Main";
import MyWork from "./routes/myWork/MyWork.js";
import Business from "./routes/business/BusinessMgr.js";
import BillList from "./routes/business/bill/BillList";
import MatList from "./routes/setting/material/MatList";
import EditMat from "./components/edit/EditMat";
import TraceCode from "./routes/trace/TraceCode.js"
import Setting from "./routes/setting/SetMgr.js";
import ExecList from "./routes/setting/executor/ExecList.js";
import PdaList from "./routes/setting/device/PdaList.js";

function RouterConfig({ history }) {
  return (
    <Router history={history}>
      <Route path='/' component={UserMain}>
        <IndexRoute component={MyWork} />
        <Route path="/MyWork" component={MyWork}>
        </Route>
        <Route path="/Business" component={Business}>
          <Route path="/Business/BillList/:billType" component={BillList} />
          <Route path="/Business/Trace/TraceCode" component={TraceCode} />
        </Route>
        <Route path="/Setting" component={Setting}>
          <Route path="/Setting/MatList" component={MatList} />
          <Route path="/Setting/MatList/EditMat" component={EditMat} />
          <Route path="/Setting/ExecList" component={ExecList} />
          <Route path="/Setting/PdaList" component={PdaList} />
        </Route>
      </Route>
      <Route path="/login" component={UserLogin} />
    </Router>
  );
}

export default RouterConfig;
